/**
 *
 */
package jp.seraph.cui;

import java.util.ArrayList;
import java.util.List;

/**
 *
 *
 */
public class DefaultConsoleContext implements ConsoleContext {
    public DefaultConsoleContext(){
        mMode = null;
        mHistory = new ArrayList<String>();
        mPaths = new ArrayList<Mode>();
    }

    private Mode mMode;
    private List<String> mHistory;
    private List<Mode> mPaths;

    /**
     *
     * @see jp.seraph.cui.ConsoleContext#getCommandHistory()
     */
    public List<String> getCommandHistory() {
        return mHistory;
    }

    public void appendHistory(String aHistory){
        mHistory.add(0, aHistory);
    }

    /**
     *
     * @see jp.seraph.cui.ConsoleContext#getMode()
     */
    public Mode getMode() {
        return mMode;
    }

    /**
     *
     * @see jp.seraph.cui.ConsoleContext#setMode(jp.seraph.cui.Mode)
     */
    public void setMode(Mode aMode) {
        mMode = aMode;
    }

    /**
     *
     * @see jp.seraph.cui.ConsoleContext#getPath()
     */
    public List<Mode> getPath() {
        List<Mode> tResult = new ArrayList<Mode>(mPaths);
        tResult.add(0, this.getMode());
        return tResult;
    }

    public void addPath(Mode aPath){
        mPaths.add(aPath);
    }
}
